package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class BlackAuditSearchCondition  extends BaseSearchCondition{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String blackNum;//卡号或商户号
	private String blackType;//类型 M商户 C卡
	private String status;//状态 0 解禁  1冻结  2待审核
	private String minDate;// 添加日期
	private String maxDate;
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		if(Constance.isNotEmpty(blackNum))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.BLACK_NUM", blackNum,"=", false));
		}
		if(Constance.isNotEmpty(blackType))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.BLACK_TYPE", blackType,"=", false));
		}
		if(Constance.isNotEmpty(status))
		{
			filedBeanList.add(new WhereHQLFieldBean("T.IN_FLAG", status,"=", false));
		}
		if (Constance.isNotEmpty(minDate)) {
			filedBeanList.add(new WhereHQLFieldBean("T.IN_DATA", minDate,
					">=", false));
		}if (Constance.isNotEmpty(maxDate)) {
			filedBeanList.add(new WhereHQLFieldBean("T.IN_DATA", maxDate,
					"<=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT COUNT(1) FROM APSTFR.TBL_POS_BLACK_INF T WHERE t.in_flag='2' ");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb=new StringBuffer();
		sb.append(" SELECT T.BLACK_NUM,T.BLACK_TYPE,T.IN_DATA,T.IN_TIME,T.IN_REASON,  ");
		sb.append("   (SELECT real_name FROM t_operators WHERE id=T.REMARK1） opName ");
		sb.append( "  FROM APSTFR.TBL_POS_BLACK_INF T WHERE t.in_flag='2' ");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return " ORDER BY T.IN_DATA DESC,T.IN_TIME DESC ";
	}

	public String getBlackNum() {
		return blackNum;
	}

	public void setBlackNum(String blackNum) {
		this.blackNum = blackNum;
	}

	public String getBlackType() {
		return blackType;
	}

	public void setBlackType(String blackType) {
		this.blackType = blackType;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getMinDate() {
		return minDate;
	}

	public void setMinDate(String minDate) {
		this.minDate = minDate;
	}

	public String getMaxDate() {
		return maxDate;
	}

	public void setMaxDate(String maxDate) {
		this.maxDate = maxDate;
	}
	
}
